<%@ page import="com.lihuanyu.upcOA.conn.databaseUtil" %>
<%@ page import="java.sql.ResultSet" %>
<%@ page import="java.util.Calendar" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
  // if(session.getAttribute("tid") != null) {
  //int tid = Integer.parseInt(session.getAttribute("tid").toString());}
  int tid = 0;
  if(session.getAttribute("tid") != null) {
    tid = Integer.parseInt(session.getAttribute("tid").toString());
  }
  Calendar a= Calendar.getInstance();
  int year=a.get(Calendar.YEAR);
  request.setCharacterEncoding("utf-8");
  String teaname = request.getParameter("teaname") == null ? "" : new String(request.getParameter("teaname"));
  String mastername = request.getParameter("masternum") == null ? "" : new String(request.getParameter("masternum"));
  databaseUtil db = new databaseUtil();
  String sql = "INSERT INTO `tech_master`(`teaname`, `masternum`, `year`, `tid`)" +
          " VALUES ('"+teaname+"','"+mastername+"',"+year+","+tid+")";
  //System.out.print(sql);
  db.executeUpdate(sql);
%>
<tr>
  <div class="col-md-6">
    <td>指导老师</td>
  </div>
  <div class="col-md-1">
    <td></td>
    <%--<td>年份</td>--%>
  </div>
  <div class="col-md-1">
    <td>人数</td>
  </div>
</tr>
<form method="post" action="#" name="add_form">
  <tr style="display: none" class="add_row">
    <div class="col-md-1">
      <td><input type="text" name="teacher_name" id="teaname2"></td>
    </div>
    <div class="col-md-1">
      <td><input type="hidden" name="year" id="year"></td>
    </div>
    <div class="col-md-1">
      <td><input type="text" name="masternum"></td>
    </div>
  </tr>
</form>
<%
  sql="select * from tech_master where tid="+tid+"";
  System.out.print(sql);
  db.executeQuery(sql);
  ResultSet rs = db.getRs();
  while (rs.next()){
    String teachername= rs.getString(2);
    String masternum=   rs.getString(3);
%>
<tr class="second">
  <div class="col-md-1">
    <td><%=teachername%></td>
  </div>
  <div class="col-md-1">
    <td>2015</td>
  </div>
  <div class="col-md-1">
    <td><%=masternum%></td>
  </div>
</tr>
<%
  }
  db.sqlclose();
%>
